import request from '@api/request.ts'
import type { LoginInfo } from './type'

/**
 * 登录成功后获取用户信息（昵称、头像、权限集合和角色集合）
 */
export function login(name: string, password: string) {
  return request<LoginInfo>({
    url: '/login',
    method: 'post',
    data: {
      name,
      password,
    },
  })
}
/**
 * 注册用户
 */
export function register(name: string, password: string) {
  return request({
    url: '/user/register',
    method: 'post',
    data: {
      name,
      password,
    },
  })
}
